package jackson.src.day01;

/*
 * Author: JacksonCoder
 * FileName: clazzVariable
 * Version: 1.0.0
 */
public class clazzVariable {
    public static void main(String[] args) {
        Person p = new Person();
        String name = "bob";
//        p.setName(name);
//        System.out.println(p.getName()); //
//        name = "alex";
//        System.out.println(p.getName()); //
        
        Person2 p2 = new Person2();
        String[] fullName = new String[] {"Homer","Simpson"};
        p2.setName(fullName);
        System.out.println(p2.getName());
        fullName[0] = "Bart";
        System.out.println(p2.getName());
    }
}

class Person2{
    private String[] name;

    public String getName() {
        return this.name[0] + " " + this.name[1];
    }

    public void setName(String[] name) {
        this.name = name;
    }
}

//class Person{
//    private String name;
//
//    public String getName(){
//        return this.name;
//    }
//
//    public void setName(String name){
//        this.name = name;
//    }
//
//}
